Better formfactor detection.

This duplicates [pull request 435](https://github.com/ArcBees/GWTP/pull/435).  I moved the commits to a new fffix branch and had to redo the PR.