Fix bug w/ division by 0.
Refactor code and delete some top commented code.