avoid side effects in helper methods

Make the ivar assignment in the initializer so that subsequent calls to
the helper method will not mutate the instance.  Also, use map / uniq
rather than checking a hash key all the time.
Merge pull request #496 from tenderlove/side_effect

avoid side effects in helper methods