More refactoring, comments added to various files