Refactored various things.