implemented error checking for forms