refactoring and preparing to deploy