initial refactoring of the code
initial refactoring