plotting and refactoring to use data frames like they should be used