some refactoring
refactoring and cleaning the code