pseudcode validation function