starting to refactor the code now