Re-implemented forms using WTForms and removed hand-coded CSRF code.