Work with templates in any directory.

Now, with test!

Fixed #45.