Added counter to hold number of errors in form validation