Formatting and comments for upload js. Includes removing some debugging code.