Plotting previous data, modal box and fixed formatting if no previous data