put code into functions