Major performance improvements but still not fully working