Refactored angular code into factory