mb sensors code optimization