refactored the API a lot