reducing scope functions in main controller