clean controller code a bit