Revert "More neat cleaning up, working with files."

This reverts commit d56c49e0b7be1a31a68f93132a902608ec542251.
Various fixes.