UAC improvements + minor code restructuring