Added methods to start and stop server and to set configuration. Some code cleanup.