added port handling to window adding framework