new plot function and smalls edits