now with postgresql and a few other modifications.