De-duplicate code