added countPattern
major cleanup
docs