Added documentation, as well as made the code compile.