cleaned up foreign keys, added comments, other cleanup