lots of comments and fixed formatting of JS parts