Added loop matcher and tests