Found a better way to handle errors in general