Reworked for compatibility with glass theme