Divide in files; generalize a bit