Refactored the code a little bit to better encapsulate service access