move some stuff from util to separate files