Correct typo in comment.
Move non-put/get functions to top.
Define put/get functions with a macro.