Changed and fixed to work on the pi