Cleaned up code.
Heaviy documented everything and untracked some generated files.