Remove duplicate code which was refactored