added port state tracking / minor bug fixes