More refactoring, simplifying api