Postgres fix
Redesign and fixes