sample code from bignerd.