using data frames instead of lists and reducing the code