Updated to use postgre db