fix: lots of weird bugs and cleanup