added functions for plotting, need to check consistency in results