Added delete function and some minor corrections cleaning