Move a few static vars left, also some fixes due to code refactoring.