massively refactored API