refactored freeiceberg and switchwall movement function