Fixed calculation of mean total steps. Cleaned up lots of code.