Move logic from utils into forms.