refactoring and broken code
refactoring the code