Added option for detecting ports

Fixes #18 
Note that #19 is still an issue