mostly final version