Handle errors better