fixed lots of errors, actually works now