implemented put function