added smooth function for arrays