Sort out licensing
Refactoring