checkValid seems to be working