refactoring gyroscope error handling