Struggling homeowners have new legal tool to challenge foreclosure