starting to rework the code in an OO manner