Finished cleaning and commenting. Will soon start a GUI version.