Make code nicer
(cherry picked from commit 17eba98)