Added count and compare functions