refactoring to clean up
refactoring code