Refactoring and project cleanup