More efficiency and got rid of grep