Added stack_id to unit, and communication functions