some comments + code refactorisation to be clearer