Added delete and fixed bugs