Refactoring: code cleanup