Code cleanup & add archive feature