takes 'next' variable