separated controller code into own script