efficient but buggy