Refactor put() function and calls.