Refactors code to render snake, apples.