Further implementing error handling