Added in a basic text writing method in the main() file. Small refactorings.