refactoring and support RaspberryPi
refactoring