refactored bson to be a struct to contain type information for faster lookup