More refactoring, implementing singleton model