moved port parsing to main methods