More refactors. and comments.