removing unnecessary lines and exits