Helper function? You repeat this at least three times.

Also, strict-check the typel