Adds better error management