remove the duplicate code