moved code blocks into functions