Debugged SIN function.