Fixed big mess in code giving tons of errors.