Updated for clang.

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