refactor: Simplify api and add tests for mux