More comments, re-factored/cleaned up code.