added logging and saving some figures to check performance