modified plotting script