Added licensing & minor refactor.