move some generic stuff into a new library