Added more default settings. Extracted global JS code to separate file.