acescence has a good answer too, which is what your example does. There's really a million different ways you can do these things.