Worked on third function, still have to plot img