added delete and other minor changes to existing code