restructuring some stuff and unnormalized score function