added neighbors and flags