Small optimizations

Signed-off-by: Konctantin <gawrilyako@gmail.com>