fix and rewrite a lot of errors hopefully