v4.1 - reimplemented database as singleton to avoid multithreading conflicts.
     - ensure settings properly read at service startup
     - improved end-game logic