added encoding for BSM. not tested