added an 'end' option