Added local mode with tests.