remove redundant code and transaction