BDEcoded refactored