moves code to its own func