More micro optimization and tests.