added wall detection