Improved comments, removed unused variables, added null to return statements.