performance improvement version 1 with previous design