refactoring for multiple robots and bug in port assignement