Made threads configurable
Add missing license header.