moving towards a working product

output from sql is properly tweaked, ready to save to couchdb