More refactor + test