added helper function and rewrite specs with it