added documentation, renaming functions