Works on Pi now, fixing minor problems