Redundant code removal and readability changes