move some of controller functions out of the header. more cleanup