refactoring code for PUMA wall