Updated server to allow dependency injection.