Adding fix for #281 (passing in -p <portNumber>) with tests, needs review

Ready for review