simplified error handling in forms, removed unnecessary code