Made sensor code compatible with scheduler