Refactor removing of leading zeros to its own function. Fix bug in ripple stage of subtraction and other minor cleanups