will merge later with original sensor code