Convert to class, add well-formed check