refactor handle_actions back into one method