Using .recursive intead of .deserialize and refactoring base ond Lucas's suggestions.