simplifying the code structure