Added cleanup to 'end' API