Improved some mathematical methods.