Put the code to functions