Maybe it is possible to make the code more compact? Can you remove empty lines 9, 15, 29, 52 and 57?