DRY'd up code, and added general accessors.

Because I needed to use the `domains()` method, I went in and cleaned up some of the code (made it more DRY), and added the ability to add generic functions easily.

Thanks for the great module.