cleanup parameter handling and added delete function