first type-checked version