integrated sensor code with Matts new test file