Refactor codes in Sup