Code improvement according to tg, pn comments