Several changes. See sembrestels comments.