Add licence
code refactor