Tried to avoid operations which might be affected by floating point precision in places where It Isn't that hard for me.