Refactor getActions

Simplify and avoid repetition.