Added z offset at beginning and end of rep. Untested.