cleaner, better commenting, fixed some vital calculation mistakes