Wrote main code for fitting sine wave.