Remove duplicated code blocks