malloc implemented. Small changes in plot