did some error-checks, restructured tex-file