enhance the for by using the gurad
remove un-necessary code
solve #3, Thanks @hempalex