minor: i would combine lines 46 and 47