removed buffer logic and added deleted function