small changes to posterior calculation