More refactoring of internal structure