Made a variable local to prevent uneccessary overwrites.
The value inside the slider control is now changable.

Added math function library.