changed functions to use list and modified toStrings