Refactored form files (and some fixes)