It's clear from documentation how to append graphics commands. But what should do if I need to remove them, for example, when a shape is clicked?