First attempt at some code that reproduces the exception I got...