encapsulated everything into a singleton class