Non-zero base-index and rbenv support

This is really just a squash and rebase of the pull requests #45 and #79, and should also close related pull request #36. There were some conflicts that I resolved when rebasing #45. #79 rebased on top of master cleanly.

Whoever merges this should probably do it manually (so that it fast-forwards) rather than using the Github merge button so the commit history is linear, since I've already rebased them on top of master.