ufm: many code cleanups