Adding in Kirill's changes for theming.