Removing cruft and updated number of tmp values needed.