refactoring to fix some problems