fixes and refactor so things break so more fixes