cleanup controller code