Improved support for clang, now uses blocks instead of nested functions, if available