Simplified code and fixed typo for complete.