Refactor action controller JS