update comments + optimize if()