Add frequency function
solved merge conflicts