added 'foreachprop'; cleaned-up style of js file