pbox calculations and added score function