Clean up and reorganize. Sort functions logically. Move jQuery element creation into individual functions. Move immediately executable code beneath all function definitions.