Moved functions to BEngine class