Re-arranged listener for deviceReady event.