Refactor API for quality