fixed math description and simplified code