bunch of line sorting ridiculousness
get the stupid sampling right