cleaned up a few things for readability,  mainly aliased math.trigfunction to trigfunction