refactoring
more fixes.