integrating greg's changes