code cleanup improved readability and performance