Refactored out some reusable logic in forms