added documentation on code