Second Commit

implement validation in read()
simplify codes