separate stuff into functions