Refactoring to break up rest and irc api.