completed script for Plot 4