refactoring - move some code to BSONloader