Using glyph references

Glyphs can be optimized more. This PR doesn't cover possible references.