added a bunch of math stuff