Added method to check and add to the 'frontier'