refactored wall logic to a separate module