Refactored code to enable function overriding in BMDieTwin