simplifying the code some