Cleaned up and commented on all the code.