open/close UI, cleanup C cruft