Modified plotting function and updated training