function moved off client side