Improved output format and added query parsing.