Pack and unpack the startkey/lastkey

Hello @x-ma, 

Please review the following commits I made in branch 'nick-key'.

97874d2bcd2c1e866634dc8ba53ebc5c6fcb27b6 (2013-11-25 16:41:18 -0500)
Pack and unpack the startkey/lastkey

11f5155e4664ebf317b2fd3cf9ec8652e85078c8 (2013-11-25 16:09:55 -0500)
Clean up pack/unpack API

R=@x-ma