Small fixes and refactorings.
Small fixes.