added documentation on the code