Separated out various ruby classes into individual files.
Further factored `preprocess`, introducing the Chapter class and Pattern module.