added check if function is called from CLI