updated some js logic and added some general notes
merged some changes in the js file