almost all changes requested by Etienne, missing unit tests