Performance improved, still some bugs