a little code cleanup in Controller