added plot for cubic functions; some restructuring