version with sinusoidal fit works