entropy and frequency functions added