add equality testing for value class
simplify scanning routine