Changing service to factory