removed duplicate code blocks