Clean up controller code