Refactoring

> Originally at https://github.com/kevin-brown/mousetrap/pull/1

This is the pull request that will be used for code review, tracking progress, and eventually generating the patch set for this refactoring.
When testing earlier I was hitting issues with the image being this small.  After making the dimensions 600x400, the detection started working again and I didn't hit any extra issues.