functions needed to be defined earlier..