added `firstError` method and names to anonymous functions