bit arrays, minor math help, graphs, tidying