refactors design to resuable API