refactor exchange beds part code