Merged updates from log repo.
Several updates to overflow checks (now significantly faster)