Adding testing a better error handling