refactor some piece of code to support new language features

Signed-off-by: Julien Peeters <contact@julienpeeters.net>