factored out a controllers class