Cleaned up and commented; ready for submission.