Fix works, but no tests yet.

This is not  a real "pull request", more of a "code review request".

Also, I haven't been able to figure out testing, and I wonder if someone could walk me through writing tests.