Initial commit of dex-count (copied from https://gist.github.com/tyvsmith/6056422)