changed code reading page ends