added entropy calculation