Code optimization. Added some comments. Removed unneeded array for javascript loading.