still buggy but going in the right direction