credits: source code from Raspi.tv