changed the array sorting function call to be the standard cross-browser version