Added an optional port

Taken from "Dotan J. Nahum" <jondotan@gmail.com> fork.