added plot function, project is messy but working