adding the before filter hook into controller