Refactoring and modifications