before functions