Fixed some misc. bugs regarding Arduinos use of black magic. Also fixed some random arithmetical bugs.