Moved file handler to its own middleware