added new version with 3d function plot