Feature/api cleanup

This is a large refactor/cleanup and setup of the foundation of the API.