added weight calculation