Better template handler