Remove extraneous elses in input code