Improved debugging

Can be hidden when the ENABLE_DEBUG switch is passed to cmake.