refactoring, fix small issues