more refactoring and simplification
more refactoring