Cleaning up a bit of code and adding support for Hash/Range query.