breaking code into functions