Use es5 array methods where possible. Fix context reference bug.