Refactoring and additional features