Cleaned up code. Added more comments.
Some instructions for compilation and running.