Rework of hexgen - but not working completely.