More efficiency, removed some old code