Even more attempts to get this working. Will be branched for now, to review later