Restructure and simplify file state