Implement onNonValid function to pass callback to