Cleaned up the code & added more comments about how it works.