Remake of functions

Splitted plot function into three functions, plot, replot and update