Improve custom 2i performance and abstraction
Patch by Miguel Angel Fernandez Diaz, reviewed by Sam Tunnicliffe for
CASSANDRA-6640