Indenting and moving nested functions outside.
Fixing js and css versions.