Improve code style
Make the initialization deterministic
Merge pull request #1303 from ahojnnes/unwrap

Deterministic initialization of unwrap + code cleanup