Stripped functionality from main and put into controller
Test for controller