add singleton pattern for mux and extracted the initialization of mux