Added documentation. Changed param names. Use repeated params. Added frequencies and isEmpty.