UK: refactor CustomPermissions to XFormPermissions
UK: code refactor
UK: code recfactor