Small fixes/refactoring.