Started breaking out core functionality into module.
More stuff in the module.
Finished breaking out core logic into module.