move some general methods to a separate class