Fix random
Trim code & add license
Merge branch 'step-1' into step-2