Fixed archiving and added the stored procedure.