incorporate some of Shaddi's changes