added documentation and changed function input methods