Added parenthesis around certain places I believe math was off.