Refactor api for clarity