More refactoring and scribbling