Added BSD licence headers. And started with worker refactoring.