Refactored wordsworth.py into a single class