Trying to integrate jroweboy's example code.