Started refactoring and cleaning up, but now doesn't run.