Squashed commit of the following:

commit 816d8dacb3e7706550a2e3fae4ed78256eda093c
Author: Arjan Verkerk <arjan.verkerk@gmail.com>
Date:   Tue Mar 5 16:55:16 2013 +0100

    Factor out averaging function, do some rounding in step determination.

commit ba5ae75172697de91896f8cb9264c13182ef2644
Author: Arjan Verkerk <arjan.verkerk@gmail.com>
Date:   Tue Mar 5 15:13:12 2013 +0100

    Flake8.

commit 145105cb34a698fe7f483fa57965ef7447d70350
Author: Arjan Verkerk <arjan.verkerk@gmail.com>
Date:   Tue Mar 5 14:50:08 2013 +0100

    Working addheight with side-looking.

commit 9c049ab4732e341d5b9a84c8da6d91fe38641344
Author: Arjan Verkerk <arjan.verkerk@gmail.com>
Date:   Mon Mar 4 17:49:52 2013 +0100

    Work in progress.