trying to make a function inside a controller work...