Cleanup, mainly removing unnecessary inline statements
add opt-out range checking