Some alterations to the lists received. Modularized code.