Moves method to function