Added deletion and fixed bugs