cleaning up code for form