now working within a controller