highly experimental hybrid code (does not quite work yet)