Code cleanup.
Performance improvement for functional tests.