Latest code for Pieter. Builds but does not run as expected