Some changes.
Attempting to make the code (so far) more modular.