Minor fixes, cleanup of obsolete function