This is a better way of doing this, I think.