Merged duplicate code