added entropy function