implemented sensor handling, refactoring