removed code redundancy - refactored actions