Refactored & prepared for API interaction