Simplified code some bit.