speed up and fixes