Fix some boundary cases and remove need for floating point.