File refactoring

Implements #22