Fixed numerous mistakes