moved form reset to a function
forms reset when the document is clicked
Added comments