remove cruft, fix errors