implemented delete, error handling in connect