simpler, if less efficient