Fixing refactoring issues