Improve theme handling