moving stuff to functions