improved complexity