Refactored sensor lock code

Refactored code in onSenserChanged() method to be more readable and
easier to build on