tweaks to app js and inlined function in es-tests for clarity