Updated and reflowed code for plot4