Updated GetUnusedInstanceID to not recycle instance ID's unless it has reached max (65535)