Refactor checkData into a util