added Error Handling