updated print code and added option param to plot