Add license, refactoring