did some modification/cleanup