Fix incorrect method signature by extracting all the code.