simpler code via js-compiling