Small changes, remove some unnecessary output
test
Use Google SparseHash for better performance
Add some more argument checking, remove some unused code