Refactored much of the api into specific files to allow easier synergy between them