Controller code cleanup