code cleanup and reverse sawtooth embed (disabled)