refactoring of bv model code