Take filename as argument and speed up.