code reorganization (to remove fs)