added a few outputs and checked the results. i'm missing only one thing: which is the first device...we should print that out. but i didn't find where this is estimated