improved code with zip and unspread