Changed ready event to pageinit