prepare sub sets function