Get rid of invalid warning
Simplify somehow the implementation