compiling, but buggy, need to fix