made some of dan's changes