Improving JS behavior to comply with field cardinality