Simplified structure

Modified some functions. Split handle_submit into handle_form and
handle_submit.