Improve tests and add license header in all files