Update ranTwave.R