Initial commit of refactored code