use call-by-value and move instead of call-by-ref