Added normalization to accelerometer values.
Fixed formatting and added a rough (broken) first swipe at orientation.