Cleaning up archive
Simpler algorithm, should be a bit faster now