Add ready event handler and tests