closure for isValid working

need to add closure for checkmax