Cleaning up stacked df code