debugged and updated documentation