Changed our while loop to use the terminate method
Changed selectWithReplacement to be a selector which is passed in as
an argument