Added some form validation and improved history table display logic