do not print empty directories
added some comments
consolidate all js scripts