updated documentation and corrected code to follow documentation