Refactor/fixes.