made wall following function