First cut code for detecting rings.

* Code is work in progress.
* Several classes of spurious rings will show up!