added documentation for each function