have to debug. looks buggy