move some code to bsmcommons 0.1