theme cleanup and refactoring