Work in #8, improve #6 and last improve for #4