Finished fixing refactoring bugs

Let's hope.