Clearer, more compact rewrite; but also slower