More SQL reading/writing
shifted lots of code to utils library