Extract validation into a subroutine.
Extract "contains" subroutine into reference sequence itself.