better implementation of the ToString macro