added new implementation of plot script