Small code refactoring

Signed-off-by: Jérôme Coupé <jercoupe@gmail.com>