Cleaning and bug fixing for form