clean up code, added plot of original function