major rewrite - ready for experiments