Remove unnecessary trailing lines