Added test_mode functionality.