refactor singleton