Refactoring and updates