project09 checking for valid in methods