Merged with 4.0 (some function args were changed)