moved variables into controller