Member loop fixes, file output, cleanup