controller code cleanup

this shouldn't change the behaviour
revert part of 93d1d866

it appears that instance methods can't be defined in this manner
without using `class_exec`
one too many begin/end blocks