simplifying the structure of the code