Eliminated duplicate code