Refactor from static to instance with a specified port