implement thm command and cleanup