Better error handling

Try-catch all the things!