fixes, fixes, refactorings, and more fixes