add archive feature and some of the runanalytic code