Refactor controller helpers