Large refactor. Added benching, tests, rakefile and file hierarchy. Also improved bit counting.