code cleaning, move some code to class methods