initial modification for nocli, based on Gisto