Refactored the api into managable packages.