Changed movement of snake (checking the borders)