Debugging features

To assist development, some features have been added to make it easier to debug. Debugging can be enabled on the server by compiling it with the DEBUG flag.