Improvements to pg lib and mid, added 'related' function