Added inserting images. Fixed bugs of splitting