Fix NPE resulting from blank first line

Should fix #6
Speed tuning