Updaed to use postgresql