Some refactoring was done, license text was added