code review

Reviewed the code, added some suggestions.