refactoring: passing walls instead of whole state