latest updates
merge with brian's code