Better templates support, more theme support, fixes