First commit to github as announced at http://goo.gl/C908Ov
FIX chain update query if it was not present in db previously
Merge branch 'master' into 7.0
Restructered files; fixed update query