Removing extraneous before and after functions.