Added extra checks and tests.