Refactoring code, foundation for repos