Simplify code for snake