Lets finally extract functionality into this gem for the API.