Moving common code to helper functions, error cards.