Improved logging
Added multiline support for query