strcut error handling implemented