Fixed delete by replacing delete with remove because delete is a preserved word in javascript