fixing grammer
reorg javascript to prevent out of order intialization