Refactor to separate actions into different handlers