Refactor

Cool service, but the code needed a bit of work. I am thinking I might borrow this and something a bit cleaner is more maintainable long-term.