implemented flatten localitations