Add compiling of inline templates.
More refactorings and testing.