fixed a lot of stuff, staging from main repo.