convert string port to int
small refactor, still needs work