Reworked logic again.
Added few xml documentation.