updating with Greg's bug fixes