remove and add layer, layer-wise gradient update, add readjpeg file