Fix random generation functions to work properly
Update transformation functions