Refactoring the head and body of snake.