Refactor multiplexer