some helping code