Some additional fix and optimization after review