some modification and polish