Broke out locate_template() into method for easier customization. Fixes #1