ABC.

Use ABC (abstract base classes) to consolidate identical functions.
Also, refactor names.
Merge pull request #2 from daniel-star/abc

ABC.