breaking the code in functions