Cleaned up sine wave generator.