Feature/hacking api listener

suggested refactor for API listener