working except for nilclass
PgOrm created and moved to own file for database functions