API Refactor and cleanup