put method and some improvements to exisiting code