Restructuring nxMain, apply context proto to nxMain