used some better math!, so my brain won't hurt to much this time.