Did some code refactoring and testing to make sure everything wirks with API