removed duplicate code