[IMP] Improved behavior to select between theme and template