refactor file open behavior slightly. some minor formatting adjustments.