Added license header.
Added license header.
Added trainer test and refactorings for it.