Better 'ready' event handler