remove bare exceptions, fix formatting issues