start of major reorganisation, make 0.6.5 work