refactoring and updates