code cleanup, added height and width to write.plot(), included filename in argument path for writing to external file