Put the same statments in a seperate function