tried a method but very slow. :(