took extra code out of application controller