cleaned up some controller code