Added some mathematical functions. Changed some comments.