Refactored the angular code to make the ASKSG controller code into an angular service