added archiving and logging