Perfected plotting, and converting plotting into a function.