Refactoring and first API calls