added encoders for ports and pids