Fixed some doc warnings & Refactored some code.