Fixed errors and made various cosmetic changes