big performance fixes