Fixed templating issues in handler and handler_impl.
Updated flags for clang and gcc.