Added code by Kasper to find best template
mmap example