simplify and catch errors properly