- Factorize port directory clean code, add error checking
- Qoute dir variables