positionMessages function