cleaning up JS code for ajax forms, adding to tasks as well