switched to using almost-equal for tolerance instead of ad-hoc method