improved content-negotiation

also refactor tests
added a macro for resolving handlers
removed bidi references