move some methods from python to ruby