Added docblocks and changed the  parameter to  in several of the functions.