some general speedups