Corrected code for RaspberryPi