Introduce error handling