More control over BSONError; code cleanup