Version 0.5.4

- Significant refactoring to clean up code that was repeated in various
places.