Fixed several bugs with bounds calculation and single quadrant mode angle determination

Also made how some functions pass errors around more consistent, and factored out some commonly used constants