Lot of code rework and improvement:

- ADD: test units, very important
- ADD: Database can now also have a thread-based locking (mutex)
- ADD: IP loopback check. Discard request if IP in the data blob is
       different from the sender
- FIX: some code moved and cleaned
- FIX: some bugs fixed

TEST: 3 PASS; 0 FAIL