complete implementation of archiving