I commented out things that used Postgres's user defined columns, since they've been deleted. I haven't gone through any of these functions yet so they may be needed later to understand what's happening.