[MINOR FIX] prevented the submission of empty forms and cleaned up code