More refactoring and bringing back some functionality.