this is a lot of code in method_missing, can we move it(maybe partly) to a new method?