moved everything into controller