Added barrier calculation