Added port support and cleaned up some error reporting