Optimizing Hidden Categories Code