Remove redundent codes to clean program